package com.example.demo.service.Impl;

import com.example.demo.entity.Image;
import com.example.demo.entity.Type;
import com.example.demo.mapper.TypeMapper;
import com.example.demo.service.TypeSelect;

import java.util.ArrayList;
import java.util.List;

public class TypeSelectImpl implements TypeSelect {

//    类型查询
    TypeMapper typemapper=new TypeMapper();
    @Override
    public List<Type> TypeSelect() {
        List<Type> list=new ArrayList<>();
        try{
            list = typemapper.TypeSelect();
        }catch(Exception e) {
            e.printStackTrace();
        }
        return list;

    }
    //    类型查询图片
    @Override
    public List<Image> TypeimgageSelect(int type_id) {
        List<Image> list=new ArrayList<>();

        try{
            list = typemapper.TypeImageSelect(type_id);
        }catch(Exception e) {
            e.printStackTrace();
        }
        return list;
    }



    @Override
    public boolean Typeupdate(int type_id, String newType_name) {

        try{
            typemapper.Typeupdate(type_id, newType_name);
        }catch(Exception e) {
            e.printStackTrace();
            return false;
        }
        return true;
    }

    @Override
    public boolean TypeAdd(String Type_name) {

        try{
            typemapper.TypeAdd(Type_name);
        }catch(Exception e) {
            e.printStackTrace();
            return false;
        }
        return true;
    }

    @Override
    public boolean  TypeDelete(int Type_id) {

        try{
            typemapper.TypeDelete(Type_id);
        }catch(Exception e) {
            e.printStackTrace();
            return false;
        }
        return true;
    }
}
